package com.qike.duola.controller;

import com.qike.duola.enums.*;
import com.qike.duola.response.BaseResult;
import com.qike.duola.response.RetResponse;
import com.qike.duola.service.BaseService;
import com.qike.duola.service.IndexService;
import com.qike.duola.vo.EnumList;
import com.qike.duola.vo.IndexVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

@RestController
@Api(description = "首页控制器")
@CrossOrigin
public class IndexController {

    private static Logger logger = LoggerFactory.getLogger(IndexController.class);


    @Autowired
    private IndexService indexService;


    /**
     * 首页列表
     *
     * @return
     */
    @ApiOperation("首页列表")
    @GetMapping("/index")
    @ResponseBody
    public BaseResult index() {
        try {
            IndexVo index = indexService.index();
            return RetResponse.makeOKRsp(index);
        } catch (Exception e) {
            logger.error(e.getMessage());
            return RetResponse.makeErrRsp(e.getMessage());
        }
    }


}
